package com.zhouys.relection;

import javax.xml.bind.annotation.XmlList;

//测试类什么时候初始化
public class Test5 {

    static {
        System.out.println("main被加载");
    }

    public static void main(String[] args) throws ClassNotFoundException {
//        主动引用
        Son son = new Son();
//        反射会产生引用的方法
        Class<?> c1 = Class.forName("com.zhouys.relection.Son");
    }
}

class Father {

    static int b = 2;

    static {
        System.out.println("父类被加载");
    }

}

class Son extends Father {
    static {
        System.out.println("子类被加载");
        m = 300;
    }

    static int m = 100;
    static final int M = 1;
}
